#include "List.h"
#include "Watch.h"

using namespace Course;

void readFromFile(string filename, List<int> &List1, List<int> &List2){
	int input;
	ifstream fin;
	fin.open(filename);
	while(!fin.eof())
	{
		fin >> input;
		int selectedList = input%2;
		if (selectedList == 1)
		{
			if(List1.search(input) == nullptr)
				List1.addAtHead(input);
		}
		else
			if(List2.search(input) == nullptr)
				List2.addAtHead(input);
	}
	fin.close();
}

int main()
{
	Course::Watch w;
	w.restart();
	Element <int> element;
	List <int> L1;
	List <int> L2;
	//L1.addAtHead(30);
	//L1.addAtHead(20);
	//L1.addAtHead(40);
	//L1.addAtHead(5);

	readFromFile("Lista.txt", L1, L2);

	Course::nanoseconds t0;
	t0 = w.elapsedNs();

	cout << "TIME: " << setw(10) << t0.count() << " Ns" << endl;
	
	cin.get();
}